try {
const dataSrcRes = await dataSrcApi.getDataSrc();
this.setState({ dataSrc: dataSrcRes.data });
resolve();
} catch (err) {
reject();
return;
}
resolve();
})
render() {
if (this.props.error) {
return (<ErrorPage message={this.props.errorMessage} />);
}
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
}}
>
<Notifications ref={this.notificationsRef} />
<div className={this.props.classes.table}>
<MaterialTable
options={{
pageSize: 10,
pageSizeOptions: [10, 25, 50, 100],
exportButton: true,
emptyRowsWhenPaging: false,
addRowPosition: 'first',
}}
columns={[
{ title: 'Short Form', field: 'shortForm' },
{ title: 'Title', field: 'title' },
{ title: 'Authors', field: 'authors' },
{ title: 'Year', field: 'year' },
]}
editable={{
onRowAdd: this.onRowAdd,
onRowUpdate: this.onRowUpdate,
onRowDelete: this.onRowDelete,
}}
data={this.state.dataSrc}
title="Data Sources"
/>
</div>
</div>
);
}
}
export default Home;